exports.StoreMainView = UI.View.subclass(
{
    className: "StoreMainView",
    initialize: function($super, storeId, categoryId) 
    {
    	$super();
        this.setFrame([TCUtil.getAdjustedX(0),TCUtil.getAdjustedY(0),TCUtil.getAdjustedX(320),TCUtil.getAdjustedY(480)]);
        
        this._backgroundImage = null;
        this._closeBtn = null;
        this._topLabel = null;
        this._tableView = null;
        this._storeId = null;
        this._categoryId = null;
        //GALocalizationHandler.getRelativeString(Core.Localization.getString("TZ_MESSAGE_OFFERS_COINS_BUCKS"),[totalCoinsDiff,totalBucksDiff]);
        this._storeId = storeId;
        this._categoryId = categoryId;
    },
    
    createView: function()
    {
    	this.addBackground();
        this.addCloseBtn();
        this.addTopLabel();
       	this._tableView = new StoreGenericTableView(this, this._storeId, this._categoryId);
        this.addChild(this._tableView);
    },
 
    addBackground: function()
    {
    	var backgroundImagePath = this.getBaseResourcePath() + "main-menu-background.png";
		this._backgroundImage =  UIFactory.getImage([TCUtil.getAdjustedX(0),TCUtil.getAdjustedY(45),TCUtil.getAdjustedX(320),TCUtil.getAdjustedY(380)], backgroundImagePath); 
        this.addChild(this._backgroundImage);
    },
    
    addCloseBtn: function()
    {
    	if(TutorialManager.getHasCompletedTutorial())
    	{
	    	var closeButtonNormalImagePath = this.getBaseResourcePath() + "close-button-normal.png";
	    	var closeButtonSelectedImagePath = this.getBaseResourcePath() + "close-button-pressed.png";
	    	
	    	this._closeBtn = UIFactory.getGenericButton([TCUtil.getAdjustedX(260), TCUtil.getAdjustedY(50), TCUtil.getAdjustedY(40), TCUtil.getAdjustedX(40)], closeButtonNormalImagePath,closeButtonSelectedImagePath,null,null,null, this);	
			this.addChild(this._closeBtn);
			
			this._closeBtn.onclick = function()
	    	{
	    		MMSoundManager.playEffect(BUTTON_TAP_SOUND);
				this.removeFromParent();
				this.destroy();
	   		}.bind(this);
    	} 
    },
    
    addTopLabel: function()
    {
    	this._topLabel = UIFactory.getTextArea([TCUtil.getAdjustedX(100), TCUtil.getAdjustedY(55), TCUtil.getAdjustedX(120), TCUtil.getAdjustedY(45)], Core.Localization.getString("SELECT_TYPE"), TCUtil.getAdjustedFontSize(70), UI.ViewGeometry.Gravity.Center);
	   	this.addChild(this._topLabel);
    },
    
    getTableView: function()
    {
    	return this._tableView;
    },
    
    getBaseResourcePath: function()
	{
		return "./Content/images/gamelayer/controllayer/storetableview/";
	},

    destroy: function()
    {
    	if(this._backgroundImage)
    	{
    		this._backgroundImage.destroy();
    		this._backgroundImage = null;
    	}
    	if(this._closeBtn)
    	{
    		this._closeBtn.destroy();
    		this._closeBtn = null;
    	}
    	if(this._topLabel)
    	{
    		this._topLabel.destroy();
    		this._topLabel = null;
    	}
    	if(this._tableView)
    	{
    		this._tableView.destroy();
    		this._tableView = null;
    	}
    },
});
